#connect to jlink jdbserver
target remote localhost:2331

#reset target
monitor reset
monitor sleep 300

#select endian
monitor endian little

monitor flash breakpoints 1


# 初始化时钟
monitor long 0xF4002000 = 0x00000001
monitor long 0xF4002000 = 0x00000002

monitor long 0xF4000800 = 0xffffffff
monitor long 0xF4000810 = 0xffffffff
monitor long 0xF4000820 = 0xffffffff
monitor long 0xF4000830 = 0xffffffff

# 2分频 -> 166M 
monitor long 0XF4001900 = 0X402

#PC18   FEMC_A4
monitor long 0XF4040290 = 0x0000000C
#PC19   FEMC_A5
monitor long 0XF4040298 = 0x0000000C
#PC20   FEMC_A6
monitor long 0XF40402A0 = 0x0000000C
#PC21   FEMC_A7
monitor long 0XF40402A8 = 0x0000000C
#PC23   FEMC_A8
monitor long 0XF40402B8 = 0x0000000C
#PC24   FEMC_A9
monitor long 0XF40402C0 = 0x0000000C
#PC25   FEMC_A11
monitor long 0XF40402C8 = 0x0000000C
#PC26   FEMC_A12
monitor long 0XF40402D0 = 0x0000000C
#PC27   FEMC_CLK
monitor long 0XF40402D8 = 0x0000000C
#PC28   FEMC_CKE
monitor long 0XF40402E0 = 0x0000000C

#PD00   FEMC_A2
monitor long 0XF4040300 = 0x0000000C
#PD01   FEMC_A3
monitor long 0XF4040308 = 0x0000000C
#PD02   FEMC_A0
monitor long 0XF4040310 = 0x0000000C
#PD03   FEMC_A1
monitor long 0XF4040318 = 0x0000000C
#PD04   FEMC_A10
monitor long 0XF4040320 = 0x0000000C

#PD05   FEMC_BA0
monitor long 0XF4040328 = 0x0000000C
#PD06   FEMC_BA1
monitor long 0XF4040330 = 0x0000000C

#PD10   FEMC_RAS
monitor long 0XF4040350 = 0x0000000C
#PD11   FEMC_CS0
monitor long 0XF4040358 = 0x0000000C
#PD12   FEMC_WE
monitor long 0XF4040360 = 0x0000000C
#PD13   FEMC_CAS
monitor long 0XF4040368 = 0x0000000C

#PD14   FEMC_D8
monitor long 0XF4040370 = 0x0000000C
#PD15   FEMC_DM1
monitor long 0XF4040378 = 0x0000000C
#PD16   FEMC_D10
monitor long 0XF4040380 = 0x0000000C
#PD17   FEMC_D9
monitor long 0XF4040388 = 0x0000000C
#PD18   FEMC_D12
monitor long 0XF4040390 = 0x0000000C
#PD19   FEMC_D11
monitor long 0XF4040398 = 0x0000000C
#PD20   FEMC_D14
monitor long 0XF40403A0 = 0x0000000C
#PD21   FEMC_D13
monitor long 0XF40403A8 = 0x0000000C
#PD22   FEMC_D15
monitor long 0XF40403B0 = 0x0000000C
#PD23   FEMC_DM0
monitor long 0XF40403B8 = 0x0000000C
#PD24   FEMC_D6
monitor long 0XF40403C0 = 0x0000000C
#PD25   FEMC_D7
monitor long 0XF40403C8 = 0x0000000C
#PD26   FEMC_D5
monitor long 0XF40403D0 = 0x0000000C
#PD27   FEMC_D4
monitor long 0XF40403D8 = 0x0000000C
#PD28   FEMC_D3
monitor long 0XF40403E0 = 0x0000000C
#PD29   FEMC_D2
monitor long 0XF40403E8 = 0x0000000C
#PD30   FEMC_D1
monitor long 0XF40403F0 = 0x0000000C
#PD31   FEMC_D0
monitor long 0XF40403F8 = 0x0000000C

# femc configuration
monitor long 0xF300C000 = 0x00000001
monitor long 0xF300C000 = 0x00000002
monitor long 0xF300C008 = 0x00030524
monitor long 0xF300C00C = 0x06030524
monitor long 0xF300C000 = 0x10000000

# 16MB
monitor long 0xF300C010 = 0x40000019
monitor long 0xF300C014 = 0x00000000

# 16-bit
monitor long 0xF300C040 = 0x00000F31
monitor long 0xF300C044 = 0x00772B33
monitor long 0xF300C048 = 0x02020B0B
monitor long 0xF300C04C = 0x36360300

# config delay cell
#monitor long 0xF300C150 = 0x0000003B
#monitor long 0xF300C150 = 0x0000203B
# 延迟线级数调整为22级
monitor long 0xF300C150 = 0x0000002B
monitor long 0xF300C150 = 0x0000202B

monitor long 0xF300C094 = 0x00000002
monitor long 0xF300C098 = 0x00000000

# precharge all
monitor long 0xF300C090 = 0x40000000
monitor long 0xF300C09C = 0xA55A000F
monitor sleep 300
monitor long 0xF300C03C = 0x00000003

# auto refresh
monitor long 0xF300C09C = 0xA55A000C
monitor sleep 300
monitor long 0xF300C03C = 0x00000003
monitor long 0xF300C09C = 0xA55A000C
monitor sleep 300
monitor long 0xF300C03C = 0x00000003

# set mode
monitor long 0xF300C0A0 = 0x00000033
monitor long 0xF300C09C = 0xA55A000A
monitor sleep 300
monitor long 0xF300C03C = 0x00000003

monitor long 0xF300C04C = 0x36360301

# SDRAM has been initialized